package com.cjx.Service;


import com.cjx.mapper.BookMapper;
import com.cjx.pojo.Books;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import java.awt.print.Book;
import java.util.List;

/**
 * @author cjx
 * @date 2021/3/22 0022 - 22:21
 */
@Service
public class BookServiceImpl implements BookService {
    //service调用dao层
    @Autowired
    private BookMapper bookMapper;

    public void setBookMapper(BookMapper bookMapper) {
        this.bookMapper = bookMapper;
    }

    @Override
    public int addBook(Books books) {

        return bookMapper.addBook(books);
    }

    @Override
    public int deleteBookById(int id) {
        return bookMapper.deleteBookById(id);
    }

    @Override
    public int updateBook(Books books) {
        return bookMapper.updateBook(books);
    }

    @Override
    public Books selectById(int id) {
        return bookMapper.selectById(id);
    }

    @Override
    public List<Books> selectAll() {
        return bookMapper.selectAll();
    }

    @Override
    public Books selectBookByName(String name) {
        return bookMapper.selectBookByName(name);
    }
}
